<template>
  <view class="page">
	  <fu-custom :isBack="true" :isBottom="true" bgColor="bg-white">
	    <view  v-if="type==0" slot="content">设置</view>
		<view  v-if="type==1" slot="content">平台规则</view>
	  </fu-custom>
    <view class="per">
		<!-- 修改密码 start -->
		<view @click="handleJump" class="per_row_box" v-if="type==0"  data-url="/pages/index/setting/account-security/index">
		  <view class="per_row solid-bottom">
		    <text class="text-lg text-black">账号与安全</text>
		    <text class="fu-iconfont text-bf">&#xe839;</text>
		  </view>
		</view>
		<!-- 修改密码 end -->
      <!-- 修改密码 start -->
      <!-- <view @click="handleJump" data-url="/pages/index/setting/modify-password/index">
        <view class="per_row">
          <text class="text-lg text-black">修改登录密码</text>
          <text class="fu-iconfont text-bf">&#xe839;</text>
        </view>
      </view> -->
      <!-- 修改密码 end -->
      <!-- 修改支付密码 start -->
    <!--  <view @click="handleJump" data-url="/pages/index/setting/modify-pay-password/index">
        <view class="per_row">
          <text class="text-lg text-black">修改提现密码</text>
          <text class="fu-iconfont text-bf">&#xe839;</text>
        </view>
      </view> -->
      <!-- 修改支付密码 end -->
      <!-- 用户协议 start -->
      <view @click="handleJump" class="per_row_box" data-url="/pages/user/login/user-agreement/index?id=43">
        <view class="per_row solid-bottom">
          <text class="text-lg text-black">用户注册协议</text>
          <text class="fu-iconfont text-bf">&#xe839;</text>
        </view>
      </view>
      <!-- 用户协议 end -->
      <!-- 隐私协议 start -->
      <view @click="handleJump" class="per_row_box" data-url="/pages/user/login/user-agreement/index?id=22">
        <view class="per_row">
          <text class="text-lg text-black">隐私政策</text>
          <text class="fu-iconfont text-bf">&#xe839;</text>
        </view>
      </view>
      <!-- 隐私协议 end -->
	  <view @click="handleJump" class="per_row_box" data-url="/pages/index/setting/about-we/index">
	    <view class="per_row">
	      <text class="text-lg text-black">关于我们</text>
	      <text class="fu-iconfont text-bf">&#xe839;</text>
	    </view>
	  </view>

      <!-- #ifdef APP-PLUS -->
	  <!-- 清除缓存 start -->
	  <view @click="clear" v-if="type==0" class="per_row_box top-border-line">
	    <view class="per_row solid-bottom">
	      <text class="text-lg text-black">清除缓存<text>{{fileSizeString}}</text></text>
	    </view>
	  </view>
	  <!-- 清除缓存 end -->
      <!-- 系统版本 start -->
     <!-- <view class="per_row_box" @click="handleTestingVersion">
        <view class="per_row">
          <text class="text-lg text-black">版本更新<text>v{{version}}</text></text>
          <text></text>
        </view>
      </view> -->
      <!-- 系统版本 end -->
      <!-- #endif -->
    </view>
    <!-- 退出登录按钮 end -->
    <view class="btn_cloce" v-if="isLogin && type==0">
      <view class="btn" @click="logout">退出登录</view>
    </view>
    <!-- 退出登录按钮 end -->
    <!-- APP更新组件 start -->
    <app-update ref="update"></app-update>
    <!-- APP更新组件 end -->
  </view>
</template>

<script>
  import AppUpdate from '../../components/app-update/app-update.vue';
	// import { TUILogin } from "@tencentcloud/tui-core";
  export default {
    components: {
      AppUpdate
    },
    data() {
      return {
        version: '', // 版本号
        fileSizeString: '0B', // 缓存大小
        oldPhone: true, // 是否是老旧设备 true: 不支持指纹或人脸识别 false: 支持指纹或人脸识别
		type:0
      };
    },
    computed: {
      // 是否登录状态
      isLogin() {
        return this.$store.getters.isLogin;
      }
    },
    onLoad(op) {
		if(op.type){
			this.type=op.type
		}
      // #ifdef APP-PLUS
      // 获取App版本号
      plus.runtime.getProperty(plus.runtime.appid, widgetInfo => {
        this.version = widgetInfo.version;
      })
      this.formatSize();
      // #endif
    },
    methods: {
      // 更新检测
      handleTestingVersion() {
        this.$refs.update.checkAppUpdate();
      },
      // 退出登录
      logout() {
        const that = this
        this.$util.showModal({
          title: '提示',
          content: '确定退出当前账号？',
          confirmColor: this.$store.state.themeColor,
          success: res => {
			 uni.clearStorageSync()
			 uni.navigateTo({
			 	url:"/pages/user/login/login-password/index"
			 })
          }
        });
      }
    }
  };
</script>

<style lang="scss" scoped>
	.page{
		background-color: #F8F8F8;
		height: 100vh;
	}

  // 列表样式 start
  .per {
    padding-bottom: 160rpx;
    font-size: 28upx;
	.per_row_box {
	  padding: 0 32rpx;
	  background-color: #fff;
	}

    .per_row {
      padding: 30upx 0;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      // border-bottom: 1px solid #ededed;
      background-color: #fff;

      text {
        &:nth-child(1) {
          width: 100%;

          text {
            width: auto;
            margin-right: 10upx;
            color: #999;
            float: right;
            line-height: 36upx;
          }
        }
      }

      .row_right {
        text-align: right;

        .aa {
          color: #999999;
          display: inline-block;
          margin-right: 10upx;
        }
      }
    }
  }

  // 列表样式 end
  .fu-iconfont {
	font-size: 24rpx;
  }

  // 退出登录按钮 start
 .btn_cloce {
 	position: fixed;
 	left: 0;
 	right: 0;
 	bottom: 0;
 	background-color: #FFFFFF;
 	border-radius: 8rpx;
 
 	.btn {
 		height: 110rpx;
 		text-align: center;
 		line-height: 110rpx;
 		color: #FC6296;
 		font-size: 32rpx;
 	}
 }
  
  // 退出登录按钮 end

  // 退出登录按钮 end
  .top-border-line{
	  border-top: 20rpx solid #F8F8F8;
  }
</style>
